package com.bbz.crawler.controller;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.plugins.Page;
import com.bbz.crawler.core.commen.model.CrawlerZhihuUrlList;
import com.bbz.crawler.service.ICrawlerZhihuUrlListService;
/**
 * <p>
 * CrawlerZhihuUrlListController
 * </p>
 *
 * @author binbin.a.zhang123
 * @since 2018-05-29
 */
@RestController
@RequestMapping("/crawlerZhihuUrlList")
public class CrawlerZhihuUrlListController  {

    @Autowired
    private ICrawlerZhihuUrlListService crawlerZhihuUrlListService;

    /**
     * 跳转到添加页面CrawlerZhihuUrlList
     */
    @RequestMapping("/addCrawlerZhihuUrlList")
    public String crawlerZhihuUrlListAdd() {
        return  "addCrawlerZhihuUrlList.html";
    }

    /**
     * 跳转到编辑页面CrawlerZhihuUrlList
     */
    @RequestMapping("/editCrawlerZhihuUrlList/{crawlerZhihuUrlListId}")
    public String editCrawlerZhihuUrlList(@PathVariable Integer crawlerZhihuUrlListId, ModelMap model) {
        CrawlerZhihuUrlList crawlerZhihuUrlList = crawlerZhihuUrlListService.selectById(crawlerZhihuUrlListId);
        model.addAttribute("item",crawlerZhihuUrlList);
        return "editCrawlerZhihuUrlList.html";
    }

    /**
     * 获取CrawlerZhihuUrlList列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return crawlerZhihuUrlListService.selectList(null);
    }

  	/**
     * 获取CrawlerZhihuUrlList列表
     */
    @RequestMapping(value = "/list/page/{page}/size/{size}")
    @ResponseBody
    public Object listPage(@PathVariable Integer page, @PathVariable Integer size) {
        return crawlerZhihuUrlListService.selectMapsPage(new Page<>(page, size), null);
    }
    
    /**
     * 新增CrawlerZhihuUrlList
     */
    @RequestMapping(value = "/add")
    public Object add(CrawlerZhihuUrlList crawlerZhihuUrlList) {
        crawlerZhihuUrlListService.insert(crawlerZhihuUrlList);
        return null;
    }

    /**
     * 删除CrawlerZhihuUrlList
     */
    @RequestMapping(value = "/delete")
    public Object delete(@RequestParam Integer crawlerZhihuUrlListId) {
        crawlerZhihuUrlListService.deleteById(crawlerZhihuUrlListId);
        return null;
    }

    /**
     * 修改CrawlerZhihuUrlList
     */
    @RequestMapping(value = "/update")
    public Object update(CrawlerZhihuUrlList crawlerZhihuUrlList) {
        crawlerZhihuUrlListService.updateById(crawlerZhihuUrlList);
        return null;
    }

    /**
     * CrawlerZhihuUrlList详情
     */
    @RequestMapping(value = "/detail/{crawlerZhihuUrlListId}")
    public Object detail(@PathVariable("crawlerZhihuUrlListId") Integer crawlerZhihuUrlListId) {
        return crawlerZhihuUrlListService.selectById(crawlerZhihuUrlListId);
    }
}
